'use strict';
var a = Object.defineProperty;
var h = (i, t, e) =>
  t in i
    ? a(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e })
    : (i[t] = e);
var l = (i, t, e) => (h(i, typeof t != 'symbol' ? t + '' : t, e), e);
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
class o {
  constructor() {
    l(this, 'lineStarts', []);
    l(this, 'addNewLine', t => this.lineStarts.push(t));
    l(this, 'linePos', t => {
      let e = 0,
        n = this.lineStarts.length;
      for (; e < n; ) {
        const r = (e + n) >> 1;
        this.lineStarts[r] < t ? (e = r + 1) : (n = r);
      }
      if (this.lineStarts[e] === t) return { line: e + 1, col: 1 };
      if (e === 0) return { line: 0, col: t };
      const s = this.lineStarts[e - 1];
      return { line: e, col: t - s + 1 };
    });
  }
}
exports.LineCounter = o;
